package com.management.department.teacherinfosystem.Repository;

import com.management.department.teacherinfosystem.Entity.Award;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface AwardRepository extends JpaRepository<Award, Long>, JpaSpecificationExecutor<Award> {
	@Query("select a from Award a where a.createdBy = ?1 order by a.createdAt desc")
	List<Award> findByCreatedBy(Long userId);
	
	@Query("select a from Award a where a.status = ?1 order by a.createdAt desc")
	List<Award> findByStatus(String status);
} 